package com.czl.module_storehouse.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.ProductBean;
import com.czl.module_storehouse.R;

import java.util.List;

/**
 * @author xubin
 */
public class DamageRegisProductAdapter extends BaseQuickAdapter<ProductBean, BaseViewHolder> {

    public DamageRegisProductAdapter(int layoutResId, @Nullable List<ProductBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ProductBean item) {
        helper.setText(R.id.tv_title, item.getSortName())
                .setText(R.id.tv_code, "编号：" + item.getProductCode())
                .setText(R.id.tv_model, "型号：" + item.getProductModel());
        helper.getView(R.id.iv_delete).setOnClickListener(v -> {
            if (getOnItemChildClickListener() != null) {
                getOnItemChildClickListener().onItemChildClick(DamageRegisProductAdapter.this, v, helper.getAbsoluteAdapterPosition());
            }
        });
    }

}
